<template>
	<view>
		<pageHeader  @back='back' :fixed='true' :border='true'>
			<text>合作说明</text>
		</pageHeader>
		<uni-load-more status="loading"  v-if="showLoading" />
		<view class="message" v-if="!showLoading">
			<rich-text :nodes="message" v-if="message" ></rich-text>
		</view>
		
		<!-- <image :src="message.photo?message.photo:'/static/img/jiameng.png'" mode="aspectFill" class="banner"></image>
		<view class="body">
			<view class="body_title">
				<text>我们的</text>
				<text class="red">优势</text>
			</view>
			<rich-text class="body_word" :nodes='newAdvantage'></rich-text>
		</view>
		<view class="body">
			<view class="body_title">
				<text>合作</text>
				<text class="red">说明</text>
			</view>
			<rich-text class="body_word" :nodes='newDescription'></rich-text>
		</view>
		<view class="body">
			<view class="body_title">
				<text>合作</text>
				<text class="red">流程</text>
			</view>
			<view class="process">
				<template v-if="message.process">
					<view v-for="(item,index) in message.process.body" :key='index'>
						<image :src="item.photo" mode=""></image>
						<text>{{item.word}}</text>
					</view>
				</template>
			</view>
		</view>
		<view class="body">
			<view class="body_title">
				<text>联系</text>
				<text class="red">方式</text>
			</view>
			<view class="contact">
				<template v-if="message.contact">
					<view class="contact_body" v-for="(item,index) in message.contact.body">
						<text class="contact_body_left">{{item.subTitle}}</text>
						<rich-text class="contact_body_right" :nodes="item.content.replace(item.emphasize,('<span>'+item.emphasize+'</span>'))"></rich-text>
					</view>
				</template>
			</view>
		</view>	 -->
		<view class="message message1" v-if="!showLoading">
			<rich-text :nodes="message1" v-if="message1" ></rich-text>
		</view>
		<view class="body" v-if="!showLoading">
			<view class="body_word" style="padding-bottom: 60rpx;">点击查看<text class="link" @tap="toAgreement">《商家入驻协议》</text></view>
		</view>
		<view class="button" @tap="toApply" v-if="noButton&&!showLoading" >
			<text>马上申请</text>
		</view>
		<view style="height: 120rpx;"></view>
	</view>
</template>

<script>
	import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue'
	import url from '@/common/util/personal.js'
	import pageHeader from "@/components/header/header.vue"
	export default {
		components: {pageHeader,uniLoadMore},
		data() {
			return {
				noButton:true,
				message:"",
				message1:'<h1>合作<span>协议</span></h1>',
				showLoading:true
			};
		},
		onLoad(e) {
			this.getMessage()
			if(e.noButton=='false'){
				this.noButton=false
			}
		},
		// computed: {
		// 	newAdvantage() {
		// 		if(!this.message.advantage){
		// 			return ""
		// 		}
		// 		return this.message.advantage.body[0].content.replace(this.message.advantage.body[0].emphasize,('<span>'+this.message.advantage.body[0].emphasize+'</span>'))
		// 	},
		// 	newDescription(){
		// 		if(!this.message.description){
		// 			return ""
		// 		}
		// 		return this.message.description.body[0].content.replace(this.message.description.body[0].emphasize,('<span>'+this.message.description.body[0].emphasize+'</span>'))
		// 	}
		// },
		methods: {
			async getMessage(){
				let res=await url.getMerchantCooperationDescription()
				this.message=res.data
				this.showLoading=false
				// console.log(this.message)
			},
			back() {
				uni.navigateBack({
					delta: 1
				})
			},
			toAgreement(){
				uni.navigateTo({
					url: '/pages/personal/storeAgreement'
				})
			},
			toApply(){
				uni.redirectTo({
					url: '/pages/personal/storeApply'
				})
			}
		},
	}
</script>

<style lang="scss">
.banner{
	display: block;
	height: 320rpx;
	width: 750rpx;
}
.body{
	border-bottom: 1rpx solid  #DDDDDD;
	.body_title{
		display: flex;
		align-items: flex-end;
		justify-content: center;
		margin-top: 40rpx;
		text{
			font-size: 36rpx;
			letter-spacing: 3rpx;
			line-height: 36rpx;
			color:#333333 ;
			font-weight: bold;
			display: block;
		}
		.red{
			font-size:42rpx;
			color: #CB4738;
			line-height: 42rpx;
			position: relative;
		}
	}
	.body_word{
		padding: 56rpx 30rpx 40rpx;
		font-size: 30rpx;
		color:#333333 ;
		line-height: 46rpx;
		letter-spacing: 1rpx;
		text-align: justify;
		box-sizing: border-box;
		width: 750rpx;
		/deep/ div{
			width: 690rpx;
			padding: 0 30rpx;
		}
		text{
			font-weight: bold;
			font-size: 32rpx;
		}
		/deep/ span{
			font-weight: bold;
			font-size: 32rpx;
		}
		.link{
			font-weight: normal;
			font-size: 30rpx;
			color: #549AEC;
			position: relative;
		}
	}
	.process{
		display: flex;
		flex-wrap: wrap;
		padding: 56rpx 79rpx 0 ;
		padding-right: 0;
		view{
			width:108rpx;
			height:154rpx ;
			position: relative;
			display: flex;
			flex-flow: column;
			align-items: center;
			margin-right: 134rpx;
			margin-bottom:60rpx ;
			image{
				width: 108rpx;
				height: 108rpx;
				display: block;
			}
			text{
				position: absolute;
				bottom: 0;
				word-break: keep-all;
				font-size:30rpx ;
				color:#333333 ;
				letter-spacing: 1rpx;
				line-height: 30rpx;
			}
		}
	}
	.contact{
		margin-top: 48rpx;
		padding-bottom:82rpx ;
		.contact_body{
			margin-top: 24rpx;
			font-size: 30rpx;
			line-height: 46rpx;
			letter-spacing: 1rpx;
			color: #333333;
			display: flex;
			padding-left: 30rpx;
			text{
				display: block;
				text-align: justify;
			}
			.contact_body_left{
				min-width:4.2em;
				word-break: keep-all;
			}
			.contact_body_right{
				width:  calc(100% - 4.2em - 42rpx);
				min-width: calc(100% - 4.2em - 42rpx);
				/deep/ span{
					font-weight: bold;
					display: inline;
				}
				text{
					font-weight: bold;
					display: inline;
				}
			}
		}
	}
}
.process>view:nth-of-type(3n){
	margin-right: 0;
}
.red::after{
	content: "";
	display: block;
	height:6rpx ;
	width: 56rpx;
	border-radius: 5rpx;
	background-color:#333333 ;
	bottom: -16rpx;
	left: 50%;
	position: absolute;
	margin-left: -28rpx;
}
.link::after{
	content: "";
	display: block;
	height:1rpx ;
	width: 8.2em;
	background-color:#549AEC ;
	bottom: -4rpx;
	left: 0.3em;
	position: absolute;
}
.button{
	height: 90rpx;
	width: 590rpx;
	margin: 120rpx auto 0rpx;
	display: flex;
	align-items: center;
	justify-content: center;
	background-color:#C84739 ;
	border-radius: 45rpx;
	text{
		white-space: pre;
		font-size:34rpx ;
		letter-spacing: 1rpx;
		color: #FFFAEB;
		line-height: 34rpx;
	}
}
.message{
	rich-text{
		/deep/ img{
			display: block;
			width: 750rpx;
			margin-left: -30rpx;
		}
		/deep/ p{
			margin: 0;
			padding: 0  30rpx;
			font-size:30rpx ;
			color: #333333;
			line-height: 46rpx;
			letter-spacing: 1rpx;
			text-align: justify;
		}
		/deep/ div{
			h1:first-of-type,h2:first-of-type,h3:first-of-type,h4:first-of-type,h5:first-of-type,h6:first-of-type{
				margin-top: 0;
			}
			table[width]+h1,table[width]+h2,table[width]+h3,table[width]+h4,table[width]+h5,table[width]+h6{
				margin-top: 0
			}
		}  
		/deep/ h1 ,/deep/ h2,/deep/ h3,/deep/ h4,/deep/ h5,/deep/ h6{
			font-size: 32rpx !important;
			color:#333333!important ;
			letter-spacing: 3rpx!important;
			line-height: 42rpx!important;
			font-weight: bold!important;
			padding-top:40rpx ;
			border-top: 1rpx solid #ddd;
			margin-bottom: 56rpx;
			margin-top: 46rpx;
			span{
				color:#CB4738 !important;
				font-size: 42rpx!important;
				position: relative;
				text-decoration: unset!important;
			}
			span::after{
				content: "";
				display: block;
				height:6rpx ;
				width: 56rpx;
				border-radius: 5rpx;
				background-color:#333333 ;
				bottom: -10rpx;
				left: 50%;
				position: absolute;
				margin-left: -28rpx;
			}
		}
		
		/deep/ table:first-of-type{
			width: 750rpx;
			tr{
				display: flex;
				padding: 0 12rpx;
			}
			td{
				width: 242rpx;
				max-height: 108rpx;
				text-align: center;
				font-size: 30rpx;
				min-height: 106rpx;
				display: block;
				padding-top: 16rpx;
				box-sizing: border-box;
				color: #333;
				img{
					height: 108rpx;
					width: 108rpx;
					margin-left:0;
					margin-top: -16rpx;
					display: inline-block;
				}
			}
			td[colspan="1"]{
				display: none;
			}
		}
		/deep/ table:nth-of-type(2){
			margin-bottom: 74rpx;
			width: 750rpx;
			tr:first-of-type{
				margin-top: 0;
			}
			tr{
				display: flex;	
				margin-top: 24rpx;
				padding-left: 30rpx;
				td{
					font-size: 30rpx;
					line-height: 46rpx;
					letter-spacing: 1rpx;
					color: #333;
					padding: 0;
					margin: 0;
					display: block;
				}
				td:first-of-type{
					width: 4.5em;
					text-align: right;
				}
				td:nth-of-type(2){
					text-align: justify;
					width:  calc(100% - 4.5em - 42rpx);
					min-width: calc(100% - 4.5em - 42rpx);
				}
				td[colspan="1"]{
					display: none;
				}
			}
		}
	}
}
.message1{
	padding: 0;
	rich-text{
		width: 750rpx;
		/deep/ h1{
			margin-top: 60rpx;
			text-align: center;
			margin-bottom: 0;
		}
	}
}
</style>
